<template>
    <div>
      <div style="margin-bottom: 20px">
        <template>
          <Input v-model="params.ee" placeholder="请输入姓名" style="width: 200px" />
          <Input v-model="params.ff" placeholder="请输入电话号" style="width: 200px;margin-left: 10px;margin-right: 10px" />
          <Button type="primary" @click="selectList">搜索</Button>
        </template>
      </div>
      <Table :columns="columns" :data="data"></Table>
      <div style="text-align: right;margin-top: 20px">
        <Page :total="params.totalRecord" show-sizer @on-change="pageAction"/>
      </div>
    </div>
</template>

<script>
import { findTestCode } from '../../../api/eventlist'

export default {
  name: 'index',
  data () {
    return {
      columns: [
        {
          title: '区',
          key: 'aa'
        },
        {
          title: '街道(镇、乡)',
          key: 'bb'
        },
        {
          title: '村委员会',
          key: 'cc'
        },
        {
          title: '村地址',
          key: 'dd'
        },
        {
          title: '账号',
          key: 'gg'
        },
        {
          title: '姓名',
          key: 'ee'
        },
        {
          title: '电话',
          key: 'ff'
        }

      ],
      data: [],
      params: { ee: '', ff: '', pageNo: 1, pageSize: 10, totalRecord: 0 }
    }
  },
  methods: {
    init () {
      findTestCode(this.params).then(ret => {
        if (ret.data.errcode === 0) {
          this.data = ret.data.data.results
          this.params.totalRecord = ret.data.data.totalRecord
        } else {
          this.$Notice.error({ title: '查询失败', desc: ret.data.errmsg })
        }
      })
    },
    pageAction (page) {
      this.params.pageNo = page
      this.init()
    },
    selectList () {
      this.params.pageNo = 1
      this.init()
    }
  },
  mounted () {
    this.init()
  }
}
</script>

<style scoped>

</style>
